<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>微信支付配置</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
	#parse('/headFiles.html')
</head>
<body>
<div class="layui-fluid">
   	<div class="layui-form" id="LAY-config-form" wid100>
		<input name="powerType" type="hidden" value="$!{powerType}">
		<div class="layui-row">
			<div class="layui-col-sm6">
				<div class="layui-form-item">
					<label class="layui-form-label">应用类型</label>
					<div class="layui-input-block">
						<select name="appType">
							#foreach($item in $appTypeList)
							<option value="$!{item.index()}" $!{utils.eq($item.index(),$appType,'selected')}>$!{item.note()}</option>
							#end
						</select>
					</div>
				</div>
			</div>
			<div class="layui-col-sm6">
				<div class="layui-form-item">
					<label class="layui-form-label">配置介绍</label>
					<div class="layui-input-block">
						<input type="text" class="layui-input" name="note" value="$!{note}">
					</div>
				</div>
			</div>
		</div><!-- /.layui-row -->
		<div class="layui-row">
			<div class="layui-col-sm6">
				<div class="layui-form-item">
					<label class="layui-form-label">所属账号组</label>
					<div class="layui-input-block">
						<select id="accountGroupId" name="accountGroupId" class="layui-hide" lay-ignore>
							<option value="$!{accountGroupId}">$!{accountGroupName}</option>
						</select>
					</div>
				</div>
			</div>
		</div>
		<div class="layui-row">
			<div class="layui-col-sm6">
				<div class="layui-form-item">
					<label class="layui-form-label">应用ID</label>
					#if($appId)
					<div class="layui-input-block">
						<input type="text" class="layui-input" name="appId" value="$!{appId}" readonly>
					</div>
					#else
					<div class="layui-input-block">
						<input type="text" class="layui-input" name="appId" value="$!{appId}">
					</div>
					#end
				</div>
			</div>
			<div class="layui-col-sm6">
				<div class="layui-form-item">
					<label class="layui-form-label">应用密钥</label>
					<div class="layui-input-block">
						#if($powerType==2)
						<input type="text" class="layui-input" name="appSecret" value="$!{appSecret}">
						#elseif($powerType==1)
						<input type="text" class="layui-disabled layui-input" name="appSecret" value="*****" readonly>
						#else
						<input type="text" class="layui-input" name="appSecret" value="$!{appSecret}">
						#end
					</div>
				</div>
			</div>
		</div><!-- /.layui-row -->
		<div class="layui-row">
			<div class="layui-col-sm6">
				<div class="layui-form-item">
					<label class="layui-form-label">商户号</label>
					<div class="layui-input-block">
						#if($powerType==2)
						<input type="text" class="layui-input" name="mchId" value="$!{mchId}">
						#elseif($powerType==1)
						<input type="text" class="layui-disabled layui-input" name="appSecret" value="*****" readonly>
						#else
						<input type="text" class="layui-input" name="mchId" value="$!{mchId}">
						#end
					</div>
				</div>
			</div>
			<div class="layui-col-sm6">
				<div class="layui-form-item">
					<label class="layui-form-label">支付密钥</label>
					<div class="layui-input-block">
						#if($powerType==2)
						<input type="text" class="layui-input" name="payKey" value="$!{payKey}">
						#elseif($powerType==1)
						<input type="text" class="layui-disabled layui-input" name="payKey" value="*****" readonly>
						#else
						<input type="text" class="layui-input" name="payKey" value="$!{payKey}">
						#end
					</div>
				</div>
			</div>
		</div><!-- /.layui-row -->
		<div class="layui-row">
			<div class="layui-col-sm6">
				<div class="layui-form-item">
					<label class="layui-form-label">免押服务ID</label>
					<div class="layui-input-block">
						#if($powerType==2)
						<input type="text" class="layui-input" name="preAuthServiceId" value="$!{preAuthServiceId}">
						#elseif($powerType==1)
						<input type="text" class="layui-disabled layui-input" name="preAuthServiceId" value="*****" readonly>
						#else
						<input type="text" class="layui-input" name="preAuthServiceId" value="$!{preAuthServiceId}">
						#end
					</div>
				</div>
			</div>
			<div class="layui-col-sm6">
				<div class="layui-form-item">
					<label class="layui-form-label">apiV3Key</label>
					<div class="layui-input-block">
						#if($powerType==2)
						<input type="text" class="layui-input" name="apiV3Key" value="$!{apiV3Key}">
						#elseif($powerType==1)
						<input type="text" class="layui-disabled layui-input" name="apiV3Key" value="*****" readonly>
						#else
						<input type="text" class="layui-input" name="apiV3Key" value="$!{apiV3Key}">
						#end
					</div>
				</div>
			</div>
		</div><!-- /.layui-row -->
		<div class="layui-row">
			<div class="layui-col-sm6">
				<div class="layui-form-item">
					<label class="layui-form-label">证书路径</label>
					<div class="layui-input-block">
						#if($powerType==2)
						<input type="text" class="layui-input" name="certificatePath" value="$!{certificatePath}">
						#elseif($powerType==1)
						<input type="text" class="layui-disabled layui-input" name="certificatePath" value="*****" readonly>
						#else
						<input type="text" class="layui-input" name="certificatePath" value="$!{certificatePath}">
						#end
					</div>
				</div>
			</div>
			<div class="layui-col-sm6">
				<div class="layui-form-item">
					<label class="layui-form-label">证书密码</label>
					<div class="layui-input-block">
						#if($powerType==2)
						<input type="text" class="layui-input" name="certificatePwd" value="$!{certificatePwd}">
						#elseif($powerType==1)
						<input type="text" class="layui-disabled layui-input" name="certificatePath" value="*****" readonly>
						#else
						<input type="text" class="layui-input" name="certificatePwd" value="$!{certificatePwd}">
						#end
					</div>
				</div>
			</div>
		</div><!-- /.layui-row -->
		<div class="layui-row">
			<div class="layui-col-sm6">
				<div class="layui-form-item">
					<label class="layui-form-label">证书编号</label>
					<div class="layui-input-block">
						#if($powerType==2)
						<input type="text" class="layui-input" name="certificateSerialNo" value="$!{certificateSerialNo}">
						#elseif($powerType==1)
						<input type="text" class="layui-disabled layui-input" name="certificateSerialNo" value="*****" readonly>
						#else
						<input type="text" class="layui-input" name="certificateSerialNo" value="$!{certificateSerialNo}">
						#end
					</div>
				</div>
			</div>
			<div class="layui-col-sm6">
				<div class="layui-form-item">
					<label class="layui-form-label">状态</label>
					<div class="layui-input-block">
						<select name="state" lay-filter="state">
							#foreach($item in $stateList)
							<option value="$!{item.index()}" $!{utils.eq($item.index(),$state,'selected')}>$!{item.note()}</option>
							#end
						</select>
					</div>
				</div>
			</div>
		</div><!-- /.layui-row -->
		<div class="layui-row">
			<div class="layui-col-sm6">
				<div class="layui-form-item">
					<label class="layui-form-label">Token类型</label>
					<div class="layui-input-block">
						<select name="tokenType" lay-filter="tokenType">
							#foreach($item in $tokenTypeList)
							<option value="$!{item.index()}" $!{utils.eq($item.index(),$tokenType,'selected')}>$!{item.note()}</option>
							#end
						</select>
					</div>
				</div>
			</div>
		</div>
		<div class="layui-row" id="http_config_panel" style="display: $!{utils.eq($tokenType,2,'block','none')};">
			<div class="layui-col-sm6">
				<div class="layui-form-item">
					<label class="layui-form-label">获取Url</label>
					<div class="layui-input-block">
						<input type="text" class="layui-input" name="config.url" value="$!{config.url}"/>
					</div>
				</div>
			</div>
			<div class="layui-col-sm6">
				<div class="layui-form-item">
					<label class="layui-form-label">获取Token</label>
					<div class="layui-input-block">
						<input type="text" class="layui-input" name="config.token" value="$!{config.token}"/>
					</div>
				</div>
			</div>
		</div>

		<!--
		<div class="layui-row">
			<div class="layui-col-sm6">
				<div class="layui-form-item">
					<label class="layui-form-label">RSAPublickKey</label>
					<div class="layui-input-block">
						#if($powerType==2)
						<input type="text" class="layui-input" name="rsaPublicKey" value="$!{rsaPublicKey}" />
						#elseif($powerType==1)
						<input type="none" class="layui-disabled layui-input" name="rsaPublicKey" value="*****"  readonly/>
						#else
						<input type="text" class="layui-input" name="rsaPublicKey" value="$!{rsaPublicKey}" />
						#end
					</div>
				</div>
			</div>
			<div class="layui-col-sm6">
				<div class="layui-form-item">
					<label class="layui-form-label">原始ID</label>
					<div class="layui-input-block">
						<input type="text" class="layui-input" name="originalId" value="$!{originalId}"/>
					</div>
				</div>
			</div>
	    </div>
		<div class="layui-row">
			<div class="layui-col-sm6">
				<div class="layui-form-item">
					<label class="layui-form-label">服务商APPID</label>
					<div class="layui-input-block">
						#if($powerType==2)
						<input type="text" class="layui-input" name="serverAppId" value="$!{serverAppId}">
						#elseif($powerType==1)
						<input type="text" class="layui-disabled layui-input" name="serverAppId" value="*****" readonly>
						#else
						<input type="text" class="layui-input" name="serverAppId" value="$!{serverAppId}">
						#end
					</div>
				</div>
			</div>
			<div class="layui-col-sm6">
				<div class="layui-form-item">
					<label class="layui-form-label">服务商商户号</label>
					<div class="layui-input-block">
						#if($powerType==2)
						<input type="text" class="layui-input" name="serverMchId" value="$!{serverMchId}">
						#elseif($powerType==1)
						<input type="text" class="layui-disabled layui-input" name="serverMchId" value="*****" readonly>
						#else
						<input type="text" class="layui-input" name="serverMchId" value="$!{serverMchId}">
						#end
					</div>
				</div>
			</div>
		</div> -->
	    <div class="layui-form-item layui-hide">
	    	<input type="button" lay-submit lay-filter="LAY-form-submit" id="LAY-form-submit" value="确认">
  		</div>
	</div>
</div>

#parse('/footFiles.html')
<script type="text/javascript">
layui.config({
  base: '$!{webRoot}/layuiadmin/'
}).extend({
  index: 'lib/index'
}).use(['index', 'form'],function (){
	var $ = layui.$,form = layui.form;

	form.on('select(tokenType)', function(data){
		if(data.value == 2){
			$('#http_config_panel').show();
		}else{
			$('#http_config_panel').hide();
		}
	});

	$('#accountGroupId').select2({
		placeholder: "请选择支付账号组",
		width: '300px',
		theme: 'bootstrap',
		allowClear : true,
		ajax: {
			url: '$!{webRoot}/config/account_group/select.data',
			method: 'post',
			delay: 250,
			processResults: function (result) {
				if (result.code == 200) {
					return {
						pagination: {more: result.body.more},
						results: result.body.data || []
					};
				} else {
					return {results: []};
				}
			}
		}
	});
});
</script>
</body>
</html>